#include <stdio.h>

#define N 100

int ret,tank,n,k,a[N];

int main()
{
	scanf("%d%d",&n,&k);
	for (int i = 0; i <= k; ++i)
	{
		scanf("%d",&a[i]);
	}
	tank = n;
	ret = 0;
	for (int i = 0; i <= k; ++i)
	{
		if(tank < a[i])
		{
			tank = n;
			++ret;
		}
		if(tank >= a[i])
		{
			tank -= a[i];
			continue;
		}
		printf("%s\n","No solution");
		return 0;
	}
	printf("%d\n",ret);
	return 0;
}